import pandas as pd
from . import config, utils


def main():
    if config.dataset == 'val':
        b_csv = config.pj_root + 'raw-data/B_train.csv'
    else:
        b_csv = config.pj_root + 'raw-data/B_test.csv'

    data = pd.read_csv(b_csv, index_col='no')
    data = data.sort_index()
    data.fillna(-1, inplace=True)

    # 把flag放到第一列
    if config.dataset == 'val':
        flag = data.flag
        data = data.drop('flag', axis=1)
        data = pd.DataFrame(flag).join(data)

    data.to_csv(config.pj_root + ('data/%s.csv' % config.dataset))


if __name__ == '__main__':
    utils.could_override_config()
    main()
